#ifndef ITEM_H
#define ITEM_H

#include <string>

#include "Entity.h"

class Item : public Entity {
public:
	enum BUCStatus {
		BLESSED,
		UNCURSED,
		CURSED
	};
public:
	~Item() {}

	inline void onConsume(const std::string& script);
	inline void onRead(const std::string& script);
	inline void onUse(const std::string& script);
	inline void onDrop(const std::string& script);
	
	void eat();
	void read();
	void use();
	void drop();
	
	
	inline void identify() { m_identified = true; }
	
	int rollDamage() const;
	
	inline int weight() const { return m_weight; }
	
	inline bool same(Item* item) const;
	
	static Item* createTestWeapon();
private:
	BUCStatus m_bucStatus;
	
	std::string m_unidentifiedName;
	bool m_identified;
	
	bool m_consumable;
	bool m_readable;
	bool m_usable;
	
	int m_damageDie;	// ex d6
	int m_numDice;		// ex 4d6
	
	int m_weight;
	
	std::string m_eatScript;
	std::string m_readScript;
	std::string m_useScript;
	std::string m_dropScript;
};

inline void Item::onConsume(const std::string& script) { 
	m_consumable = true;
	m_eatScript = script;
}

inline void Item::onRead(const std::string& script) { 
	m_readable = true; 
	m_readScript = script; 
}

inline void Item::onUse(const std::string& script) { 
	m_usable = true; 
	m_useScript = script;
}

inline void Item::onDrop(const std::string& script) { 
	m_dropScript = script;
}


inline bool Item::same(Item* item) const {
	return item->m_identified == m_identified
		&& item->m_name == m_name
		&& item->m_bucStatus == m_bucStatus;
}

#endif